<?php ob_start();
    $jobcat = Model_Listing_Attribute::one(array('_id' => $this->listing->jobcategory));
    $jobfun = Model_Listing_Attribute::one(array('_id' => $this->listing->jobfunction));

    $education = Model_Listing_Job::getEducation();
	$internal_lng = $this->listing->getInternalLanguage();
	$cat_search = $this->listing->category[0]->getParent();
?>
	<?php 
	if( $this->current_language == 'en'){
	    if (!empty($this->listing->company_name_en)) {
	    	$compname = '<a href="/search/regular?small_category_list=' . $cat_search->path[0] . '&company_name=' . $this->listing->company_name_en . '">'. $this->listing->company_name_en . "</a>";
	        echo $this->dtDd($this->t('Company Name', $internal_lng), $compname, true);
	    }
	} else {
		if (!empty($this->listing->company_name_tc)) {
			$compname = '<a href="/search/regular?small_category_list=' . $cat_search->path[0] . '&company_name=' . $this->listing->company_name_tc . '">'. $this->listing->company_name_tc . "</a>";
	        echo $this->dtDd($this->t('Company Name', $internal_lng), $compname, true);
	    }
	}
    ?>   
    <?php if (!empty($this->listing->jobcategory)) {
        echo $this->dtDd($this->t('Job Category', $internal_lng), $jobcat->name, true);
    }?>
    <?php if (!empty($this->listing->jobfunction)) {
        echo $this->dtDd($this->t('Job Function', $internal_lng), $jobfun->name, true);
    }?>

    <?php if (!empty($this->listing->employmenttype)) {
        $i          = 0;
        $field      = '';
        $views = Model_Listing_Job::getEmploymentType();
        $to_add     = '';
        foreach ((array)$this->listing->employmenttype as $data) {
            $field .= $to_add . $this->t($views[$data], $internal_lng);
            $i++;
            $to_add = ', ';
        }
        echo $this->dtDd($this->t('Employment Type', $internal_lng), $field, true);
    }?>
    <?php if (!empty($this->listing->joblocation)) {
        $i          = 0;
        $field      = '';
        $views = Model_Listing_Job::getJobLocation();
        $to_add     = '';
        foreach ((array)$this->listing->joblocation as $data) {
            $field .= $to_add . $this->t($views[$data], $internal_lng);
            $i++;
            $to_add = ', ';
        }
        echo $this->dtDd($this->t('Job Location', $internal_lng), $field, true);
    }?>

    <?php if (!empty($this->listing->careerlevel)) {
        $i          = 0;
        $field      = '';
        $views = Model_Listing_Job::getCareerLevel();
        $to_add     = '';
        foreach ((array)$this->listing->careerlevel as $data) {
            $field .= $to_add . $this->t($views[$data], $internal_lng);
            $i++;
            $to_add = ', ';
        }
        echo $this->dtDd($this->t('Career Level', $internal_lng), $field, true);
    }?>

    <?php if (!empty($this->listing->salary)) {
    	$views = Model_Listing_Job::getSalaryPostAd();
    	$salary = '<a href="/search/regular?small_category_list=' . $cat_search->path[0] . '&salary=' . $this->listing->salary . '">'. $views[$this->listing->salary] . "</a>";
        echo $this->dtDd($this->t('Salary per Month', $internal_lng), $salary, true);
    }?>
    <?php if (!empty($this->listing->salary_hour)) {
    	$views = Model_Listing_Job::getSalaryHourPostAd();
    	$salary_hour = '<a href="/search/regular?small_category_list=' . $cat_search->path[0] . '&salary_hour=' . $this->listing->salary_hour . '">'. $views[$this->listing->salary_hour] . "</a>";
        echo $this->dtDd($this->t('Salary per Hour', $internal_lng), $salary_hour, true);
    }?>
    <?php if (!empty($this->listing->negotiable)) {
          if ($this->listing->negotiable == 1) {
            echo $this->dtDd($this->t('Negotiable', $internal_lng), 'Yes', true) ;
          } else {
            echo $this->dtDd($this->t('Negotiable', $internal_lng), 'No', true) ;
          }
      }
    ?>
    <?php
    if (!empty($this->listing->yearexperience)) {
        $views = Model_Listing_Job::getYearExperience();
        $yearexperience = '<a href="/search/regular?small_category_list=' . $cat_search->path[0] . '&yoe=' . $this->listing->yearexperience . '">'. $views[$this->listing->yearexperience] . "</a>";
        echo $this->dtDd($this->t('Years of Experience', $internal_lng), $this->t($yearexperience, $internal_lng), true);
    }
    ?>

    <?php if (!empty($this->listing->education)) {
    	$educ = '<a href="/search/regular?small_category_list=' . $cat_search->path[0] . '&education=' . $this->listing->education . '">'. $education[$this->listing->education] . "</a>";
        echo $this->dtDd($this->t('Education Level', $internal_lng), $educ, true);
    }?>
    <?php if (!empty($this->listing->residentstatus)) {
        $i          = 0;
        $field      = '';
        $views = Model_Listing_Job::getResidentStatus();
        $to_add     = '';
        foreach ((array)$this->listing->residentstatus as $data) {
            $field .= $to_add . $this->t($views[$data], $internal_lng);
            $i++;
            $to_add = ', ';
        }
        echo $this->dtDd($this->t('Resident Status', $internal_lng), $field, true);
    }?>

    <?php if (!empty($this->listing->freshgraduate)) {
          if ($this->listing->freshgraduate == 1) {
            echo $this->dtDd($this->t('Fresh Graduates Considered', $internal_lng), "Yes", true) ;}
          else {
            echo $this->dtDd($this->t('Fresh Graduates Considered', $internal_lng), "No", true) ;}}?>
    <?php
    if (!empty($this->listing->companybenefits)) {
        $i          = 0;
        $field      = '';
        $views = Model_Listing_Job::getCompanyBenefits();
        $to_add     = '';
        foreach ((array)$this->listing->companybenefits as $data) {
            $field .= $to_add . $views[$data];
            $i++;
            $to_add = ', ';
        }
        echo $this->dtDd($this->t('Company Benefits', $internal_lng), $field, true);
    }
    ?>  
     

<?php $content = trim(ob_get_clean())?>
<?php if (!empty($content)):?>
<section class="category">
    <h3><?php echo $this->t('工作內容', $internal_lng)?></h3>
        <?php echo $content ?>
</section>
<?php endif;?>
